#ifndef VNav_H
#define VNav_H					 

#include "VNavItemTable.h"
#include "VNavItemTables.h"
#include "VNavTreeView.h"

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

class VNavItemRoot : public VNavItem
{
	Q_OBJECT
	
public:
	VNavItemRoot();

public: // VNavItem
	virtual VNavItemType::EType eType() const { return VNavItemType::EType_root;}
	virtual QString displayName() const { return "root";}

	virtual bool canFetchMore() const;
	virtual QList<VNavItem*> fetchMore();
};

///////////////////////////////////////////////////////////////////////////////
#include "../VCommon/vmodule.h"

class VNavView : public VAbstractView
{
	Q_OBJECT

public:
	VNavView(const QString &name);
	~VNavView();

public:
	virtual void activate();
	virtual void deactivate();
	virtual QList<QMenu*> menu() const { return m_menus;}
	virtual QList<QToolBar*> toolbar() const;

private slots:
	void dockNavTreeView_visibilityChanged(bool visible);
	void slot_currentItemChanged(VNavItem *current);
	void slot_currentChanged(const QModelIndex &currentIndex,const QModelIndex &previousIndex);
	void slot_collapsed(const QModelIndex &index);

private:
	void deleteItemView();
	void setupQss();
	
private:
	QMainWindow *findMainWindow() const;

	VNavItemViewPtr m_itemView;
	VNavItemRoot *m_itemRoot;
	VNavItemModel *m_navItemModel;
	VNavSelectionModel *m_navSelectionModel;
	VNavTreeView *m_navTreeView;

	QDockWidget *m_dockNavTreeView;
	QToolBar *m_dockNavTreeView_toolBar;
	QStackedWidget *m_stackedWidget;
	QSplitter *m_hSplitter;

	QList<QToolBar*> m_toolBars;
	QList<QToolBar*> m_toolBarsView;
	QList<QMenu*> m_menus;
};

///////////////////////////////////////////////////////////////////////////////

#endif
